package top.aicey.ai.sparring.processor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import top.aicey.ai.sparring.common.holder.SparringConfigProperties;
import top.aicey.ai.sparring.common.holder.SparringContext;

import java.util.Map;

/**
 * @author yangyongping
 * @date 2025-01-11 2:24 下午
 */
@Component
public class DefaultSparringContextProcessorExecutor implements SparringContextProcessorExecutor {

    @Autowired
    private Map<String, SparringContextProcessor> contextProcessorMap;

    @Autowired
    private SparringConfigProperties properties;

    @Autowired
    private SparringContextProcessorSelector selector;

    /**
     * 读取实例内容
     *
     * @param instanceId
     * @return
     */
    @Override
    public SparringContext get(String instanceId) {
        return selector.get().get(instanceId);
    }

    /**
     * 设置上下文内容
     *
     * @param context
     * @return
     */
    @Override
    public void put(SparringContext context) {
        selector.get().put(context);
    }

    /**
     * 清除上下文内容
     *
     * @param instanceId
     * @return
     */
    @Override
    public void clear(String instanceId) {
        selector.get().clear(instanceId);
    }

}
